package com.hq.fxh.No3_TuiGuang.MyMoBan.Activity.item;

import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hq.fxh.No3_TuiGuang.MyMoBan.Activity.AdBannerInfo;
import com.hq.fxh.R;


/**
 * Created by Lenovo on 2016/11/26.
 */
public class StoreAdContentItem extends LinearLayout {
    /** 名片广告图片 */
    private ImageView ivStorePic;
    private TextView tvStoreInfo;
    private TextView tvPrice;
    /** 地址 */
    private TextView tvAddress;
    public StoreAdContentItem(Context context) {
        super(context);
        inflate(context, R.layout.item_store_ad_content, this);
        initView();
    }

    private void initView() {
        ivStorePic = (ImageView) findViewById(R.id.ivStorePic);
        tvStoreInfo = (TextView) findViewById(R.id.tvStoreInfo);
        tvPrice = (TextView) findViewById(R.id.tvPrice);
        tvAddress = (TextView) findViewById(R.id.tvAddress);
    }

    /**
     *
     * @param adInfo
     */
    public void showAdInfo(final AdBannerInfo adInfo){
        if(adInfo != null){
            final AdBannerInfo.AdvertDetailBean merchantArticleQQModel = adInfo.getAdvert_detail();
            if(merchantArticleQQModel != null){
                AdBannerInfo.AdvertDetailBean.ProductInfoBean Product_info = merchantArticleQQModel.getProduct_info();
                tvStoreInfo.setText(Product_info.getName());
                tvPrice.setText(Product_info.getPrice());
                tvAddress.setText("");
                String url = Product_info.getPic();
                if(!TextUtils.isEmpty(url)){
//                    GlideUtils.loadRoundedImage(getContext(),url,getContext().getResources().getDimensionPixelSize(R.dimen.size_6),ivStorePic);
                }
            }
        }
    }
}
